{include file="public/header" /}
<link href="/dist/css/zoomify.min.css" rel="stylesheet">

<body>
	<div class="layui-tab">
		<ul class="layui-tab-title">
			<li class="layui-this">还款单数</li>
			<li>还款金额</li>
		</ul>
		<div class="layui-tab-content">
			<!--还款单数-->
			<div class="layui-tab-item layui-show">
				<div class="layui-fluid">
					<div class="layui-card">
						<div class="layui-form layui-card-header layuiadmin-card-header-auto">
							<div class="layui-form-item">

								<div class="layui-inline">
									<label class="layui-form-label">日期范围</label>
									<div class="layui-input-block">
										<input type="text" name="ApplyTime" class="layui-input" id="test6" placeholder=" - ">
									</div>
								</div>

								<div class="layui-inline">
									<button class="layui-btn layuiadmin-btn-useradmin" lay-submit lay-filter="LAY-user-front-search">
										   <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
								</button>
								</div>
							</div>
						</div>
						<div class="layui-card-body">
							<table id="LAY-user-manage_huankuan_dan" lay-filter="LAY-user-manage"></table>
							<script type="text/html" id="table-useradmin-webuser">
								<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="qudao_danzi"><i class="layui-icon layui-icon-edit"></i>渠道详情</a>
							</script>
						</div>
					</div>
				</div>
			</div>
			<!--还款金额-->
			<div class="layui-tab-item">
				<div class="layui-fluid">
					<div class="layui-card">
						<div class="layui-form layui-card-header layuiadmin-card-header-auto">
							<div class="layui-form-item">
								<div class="layui-inline">
									<label class="layui-form-label">日期范围</label>
									<div class="layui-input-block">
										<input type="text" name="ApplyTime" class="layui-input" id="test7" placeholder=" - ">
									</div>
								</div>

								<div class="layui-inline">
									<button class="layui-btn layuiadmin-btn-useradmin" lay-submit lay-filter="LAY-user-front-search_money">
										   <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
									</button>
								</div>
							</div>
						</div>
						<div class="layui-card-body">
							<table id="LAY-user-manage_huankuan_money" lay-filter="LAY-user-manage_money"></table>
							<script type="text/html" id="table-useradmin-webuser_money">
								<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="qudao_money"><i class="layui-icon layui-icon-edit"></i>渠道详情</a>
							</script>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</body>

{include file="public/footer" /}
<!-- 注意：如果你直接复制所有代码到本地，上述js路径需要改成你本地的 -->
<script src="/dist/js/zoomify.min.js"></script>
<script>
	layui.use(['index', 'table', 'laydate', 'element'], function() {
		var $ = layui.$,
				form = layui.form,
				table = layui.table,
				laydate = layui.laydate;

		//监听搜索 - 单数
		form.on('submit(LAY-user-front-search)', function(data){
			var field = data.field;
			//执行重载
			table.reload('LAY-user-manage_huankuan_dan', {
				where:{
					'ApplyTime':field.ApplyTime,
				}
			});
		});

		//监听搜索 - 金额
		form.on('submit(LAY-user-front-search_money)', function(data){
			var field = data.field;
			//执行重载
			table.reload('LAY-user-manage_huankuan_money', {
				where:{
					'ApplyTime':field.ApplyTime,
				}
			});
		});

		//还款单数
		table.render({
			elem: '#LAY-user-manage_huankuan_dan',
			even: true, //开启隔行背景
			url:"{:url('admin/sum/repayment')}",
			toolbar: '#test-table-toolbar-toolbarDemo',
			title: '还款单数',
			height: 'full-250', //最大高度
			cols: [
				[
					{field: 'time',title: '日期',width: 110,rowspan: 2},
					{field: 'yhNum',title: "<span lay-tips='当日到期应还订单数'>应还单数?</span>",width: 100,rowspan: 2},
					{field: 'shNum',title: "<span lay-tips='当日到期并已还款的订单数'>实还单数?</span>",width: 100,rowspan: 2},
					{field: 'whNum',title: "<span lay-tips='未还单数 = 应还单数-实还单数'>未还单数?</span>",width: 100,rowspan: 2},
					{field: 'sumHkLv',title: "<span lay-tips='还款率 = (实还单数/应还单数)*100%'>还款率?</span>",width: 100,rowspan: 2},
					{field: 'qeNum',title: "<span lay-tips='应还单数中全额还清的订单数'>全额单数?</span>",width: 100,rowspan: 2},
					{field: 'sumQeLv',title: "<span lay-tips='全额率 = (全额单数/应还单数)*100%'>全额率?</span>",width: 100,rowspan: 2},
					{field: 'xqNum',title: "<span lay-tips='应还单数中续期的订单数'>续期单数?</span>",width: 100,rowspan: 2},
					{field: 'sumXqLv',title: "<span lay-tips='续期率 = (续期单数/应还单数)*100%'>续期率?</span>",width: 100,rowspan: 2},

					{field: 'fjNum',title: "<span lay-tips=''>复借单数?</span>",width: 100,rowspan: 2},
					{field: 'fjLv',title: "<span lay-tips=''>复借率?</span>",width: 100,rowspan: 2},

					{align: 'center1',title: "<p style='text-align:center' lay-tips='用户第一笔借款视为首借'>首借?</p>",colspan: 6},
					{align: 'center2',title: "<p style='text-align:center'>续期</p>",colspan: 6},
					{align: 'center2',title: "<p style='text-align:center' lay-tips='用户在已有一笔已完成订单基数上后续订单均属于续期'>复借?</p>",colspan: 6}
				],[
					{field: 'sjYhNum',title: '应还单数',width: 90},
					{field: 'sjShNum',title: '已还单数',width: 90},
					{field: 'sjWhNum',title: '未还单数',width: 90},
					{field: 'sjHkLv',title: '还款率',width: 90},
					{field: 'sjQeNum',title: '全额单数',width: 90},
					{field: 'sjXqNum',title: '首借单数',width: 90},

					{field: 'xjYhNum',title: '应还单数',width: 90},
					{field: 'xjShNum',title: '已还单数',width: 90},
					{field: 'xjWhNum',title: '未还单数',width: 90},
					{field: 'xjHkLv',title: '还款率',width: 90},
					{field: 'xjQeNum',title: '全额单数',width: 90},
					{field: 'xjXqNum',title: '续期单数',width: 90},

					{field: 'fjYhNum',title: '应还单数',width: 90},
					{field: 'fjShNum',title: '已还单数',width: 90},
					{field: 'fjWhNum',title: '未还单数',width: 90},
					{field: 'fjHkLv',title: '还款率',width: 90},
					{field: 'fjQeNum',title: '全额单数',width: 90},
					{field: 'fjXqNum',title: '复借单数',width: 90},
				]
			],
			page: true
		});
		//还款金额
		table.render({
			elem: '#LAY-user-manage_huankuan_money',
			even: true, //开启隔行背景
			url: "{:url('admin/sum/repayment')}",
			toolbar: '#test-table-toolbar-toolbarDemo',
			title: '还款金额',
			height: 'full-250', //最大高度
			cols: [
				[
					{field: 'time',title: '日期',width: 110,rowspan: 2},
					{field: 'yhMoney',title: "<span lay-tips='当日到期应还订单数'>应还单数?</span>",width: 100,rowspan: 2},
					{field: 'shMoney',title: "<span lay-tips='当日到期并已还款的订单数'>实还单数?</span>",width: 100,rowspan: 2},
					{field: 'whMoney',title: "<span lay-tips='未还单数 = 应还单数-实还单数'>未还单数?</span>",width: 100,rowspan: 2},
					{field: 'sumHkLv',title: "<span lay-tips='还款率 = (实还单数/应还单数)*100%'>还款率?</span>",width: 100,rowspan: 2},
					{field: 'qeMoney',title: "<span lay-tips='应还单数中全额还清的订单数'>全额单数?</span>",width: 100,rowspan: 2},
					{field: 'sumQeLv',title: "<span lay-tips='全额率 = (全额单数/应还单数)*100%'>全额率?</span>",width: 100,rowspan: 2},
					{field: 'xqMoney',title: "<span lay-tips='应还单数中续期的订单数'>续期单数?</span>",width: 100,rowspan: 2},
					{field: 'sumXqLv',title: "<span lay-tips='续期率 = (续期单数/应还单数)*100%'>续期率?</span>",width: 100,rowspan: 2},

					{field: 'fjMoney',title: "<span lay-tips=''>复借单数?</span>",width: 100,rowspan: 2},
					{field: 'fjLv',title: "<span lay-tips=''>复借率?</span>",width: 100,rowspan: 2},

					{align: 'center1',title: "<p style='text-align:center' lay-tips='用户第一笔借款视为首借'>首借?</p>",colspan: 6},
					{align: 'center2',title: "<p style='text-align:center'>续期</p>",colspan: 6},
					{align: 'center2',title: "<p style='text-align:center' lay-tips='用户在已有一笔已完成订单基数上后续订单均属于续期'>复借?</p>",colspan: 6}
				],[
					{field: 'sjYhMoney',title: '应还单数',width: 90},
					{field: 'sjShMoney',title: '已还单数',width: 90},
					{field: 'sjWhMoney',title: '未还单数',width: 90},
					{field: 'sjHkLv',title: '还款率',width: 90},
					{field: 'sjQeMoney',title: '全额单数',width: 90},
					{field: 'sjXqMoney',title: '首借单数',width: 90},

					{field: 'xjYhMoney',title: '应还单数',width: 90},
					{field: 'xjShMoney',title: '已还单数',width: 90},
					{field: 'xjWhMoney',title: '未还单数',width: 90},
					{field: 'xjHkLv',title: '还款率',width: 90},
					{field: 'xjQeMoney',title: '全额单数',width: 90},
					{field: 'xjXqMoney',title: '续期单数',width: 90},

					{field: 'fjYhMoney',title: '应还单数',width: 90},
					{field: 'fjShMoney',title: '已还单数',width: 90},
					{field: 'fjWhMoney',title: '未还单数',width: 90},
					{field: 'fjHkLv',title: '还款率',width: 90},
					{field: 'fjQeMoney',title: '全额单数',width: 90},
					{field: 'fjXqMoney',title: '复借单数',width: 90},
				]
			],
			page: true
		});

		//日期范围
		laydate.render({
			elem: '#test6',
			range: true
		});

		// //监听行事件
		// table.on('row(LAY-user-manage)', function(obj){
		// 	if(obj.data.time){
		// 		layer.open({
		// 			type: 2
		// 			,title: ''
		// 			,content: '/admin.php/sum/repaymentChannel/time/' + obj.data.time + '/viewType/repayment_channer_num'
		// 			,maxmin: true
		// 			,area:['90%','80%']
		// 			,shadeClose:true
		// 		});
		// 	}
		// });
		//
		// //监听行事件
		// table.on('row(LAY-user-manage_money)', function(obj){
		// 	if(obj.data.time){
		// 		layer.open({
		// 			type: 2
		// 			,title: ''
		// 			,content: '/admin.php/sum/repaymentChannel/time/' + obj.data.time + '/viewType/repayment_channer_money'
		// 			,maxmin: true
		// 			,area:['90%','80%']
		// 			,shadeClose:true,
		// 		});
		// 	}
		// });

		//日期范围
		laydate.render({
			elem: '#test7',
			range: true
		});
	});
</script>
